<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>扩展运算符</title>
</head>

<body>
    <div></div>
    <div></div>
    <div></div>
    <script>
        //  ...扩展运算符能将数组转换为逗号分隔的 参数序列
        const stu = ['sun', 'xu', 'sang'];
        function play() {
            console.log(arguments);
        }
        play(stu);    //length==1
        play(...stu);    //length==3
        play('sun', 'xu', 'sang');    //length==3
        //1  数组合并
        const x = [1, 2, 3];
        const y = [4, 5, 6];
        const hb = x.concat(y);
        console.log(hb);
        const hb1 = [...x, ...y];
        console.log(hb1);
        //2  数组克隆
        const arr = [111, 222, 333, 444];
        const kl = [...arr];
        console.log(kl);
        //3  将伪数组转换为真数组
        let div = document.querySelectorAll('div');
        console.log(div);   //nodelist为数组形式输出
        const div1 = [...div];
        console.log(div1);   //真正的数组形式输出
    </script>
</body>

</html>